import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
import { type PaginationProps } from "@pureadmin/table";

type proxyData = {
  isSuccess?: boolean;
  msg?: string;
  pageInfo?: object;
  proxHeader?: string;
  proxBody?: string;
  proxData?: string;
  proxCellArr?: Array<any>;
  rowIndex?: number;
  startCol?: number;
  endCol?: number;
  dataArr?: Array<any>;
  proxyMiaoShu?: string;
};

type resultAPI = {
  isSuccess?: boolean;
  msg?: string;
  pageInfo?: object;
  result?: Array<any>;
  onePage?: PaginationProps;
};

export const getProxyData = (data?: object) => {
  return http.request<proxyData>("post", baseUrlApi("Analysis/getProxyModel"), {
    data
  });
};

export const saveProxyData = (data?: object) => {
  return http.request<resultAPI>("post", baseUrlApi("Analysis/saveProxyData"), {
    data
  });
};

export const uploadFuJian = (data?: object) => {
  return http.request<resultAPI>(
    "post",
    baseUrlApi("Analysis/uploadFuJian"),
    {
      data
    },
    {
      headers: {
        "Content-Type": "multipart/form-data"
      }
    }
  );
};
